#include <cstdio>
#include <iostream>
#include "logger.h"

void testGetTime()
{
    std::string str;
    Logger::getLogInstance()->open("lalala.txt");
    Logger::getLogInstance()->getNowTime(str);
    char time[32];
    Logger::getLogInstance()->getNowTime(time, sizeof(time));
    std::cout << "str: " << str << std::endl;
    std::cout << "time: " << time << std::endl;
    std::cout << "=========================================" << std::endl;
}

void testLog()
{
    Logger::getLogInstance()->open("lalala.txt");
    Logger::getLogInstance()->log(Logger::DEBUG, __FILE__ , __LINE__, 
    "name:%s age:%d", "lightning", 24);
    std::cout << "=========================================" << std::endl;
}

int main(void)
{
    // testGetTime();
    // testLog();
    Logger::getLogInstance()->open("lalala.txt");
    // Logger::getLogInstance()->setLogLevel(Logger::ERROR);
    // Logger::getLogInstance()->setLogMaxSize(10);
    MY_DEBUG("name:%s age:%d", "lightning", 24);
    MY_INFO("name:%s age:%d", "lightning", 24);
    MY_WARN("name:%s age:%d", "lightning", 24);
    MY_ERROR("name:%s age:%d", "lightning", 24);
    MY_FATAL("name:%s age:%d", "lightning", 24);
    MY_LEVEL_COUNT("name:%s age:%d", "lightning", 24);

    PRINT_DEBUG("name:%s age:%d", "lightning", 24);
    PRINT_INFO("name:%s age:%d", "lightning", 24);
    PRINT_WARN("name:%s age:%d", "lightning", 24);
    PRINT_ERROR("name:%s age:%d", "lightning", 24);
    PRINT_FATAL("name:%s age:%d", "lightning", 24);
    PRINT_LEVEL_COUNT("name:%s age:%d", "lightning", 24);

    return 0;
}